<template>
  <div>
    <!-- el-menu-item表示子菜单项,index设置为路由path，则可以跳转 -->
    <el-menu-item :index="item.path" v-if="item.children.length==0">
        <i class="el-icon-user-solid"></i>
        {{item.menuName}}
    </el-menu-item>

    <el-submenu :index="item.path" v-else>
      <template slot="title">
        <i class="el-icon-user"></i>
        <span>{{item.menuName}}</span>
      </template>
      <MyMenuItem v-for="(child,index) in item.children" :key="index" :item="child"></MyMenuItem>
    </el-submenu>
  </div>
</template>

<script>
export default {
    name:"MyMenuItem",
    props:["item"]
}
</script>

<style scoped>

</style>